from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
wresrt=webdriver.Chrome()
wresrt.get('https://www.baidu.com/')
try:
    wresrt.find_element_by_id('pp')
except NoSuchElementException:
    print('找不到节点')
finally:
    wresrt.close() 